#pragma once 
#include <iostream>
#include <pthread.h>

namespace cp_task{
  class Task{
    private:
      int x_;
      int y_;
      char op_;
    public:
      Task()
        {}
      Task(int x, int y, char op) : x_(x), y_(y), op_(op)
      {}
      ~Task()
        {}
      int run(){
        int ret = 0;
        switch(op_){
          case '+':
            ret = x_ + y_;
            break;
          case '-':
            ret = x_ - y_;
            break;
          case '*':
            ret = x_ * y_;
            break;
          case '/':
            ret = x_ / y_;
            break;
          case '%':
            ret = x_ % y_;
            break;
          default:
            std::cout << "errer" << std::endl;
            break;
        }
        std::cout <<"线程" << pthread_self() << "正在处理" << x_ << op_ << y_ << "=" << ret <<std::endl;
        return ret;
      }
  };
}
